<?php
//模型类
    class Model{
        public function __construct() {
            //连接数据库
            $link = @mysql_connect(
                C('DB_IPADDR'),
                C('DB_USERNAME'), 
                C('DB_PWD')
            );
            mysql_query("use  " . C('DB_NAME'));
        }
        
        public function query($sql){
            $temp = [];
            $result = mysql_query($sql);
            while($row = mysql_fetch_assoc($result)){
                $temp[] = $row;
            }
            return $temp;
        }
    }
